# $Id$
# Maintainer: Ronald van Haren <ronald@archlinux.org>
# Contributor: Chirantan Ekbote <chirantan.ekbote at gmail.com>
# Contributor: Kringel

pkgname=eigen
pkgver=3.3.5
pkgrel=3
pkgdesc="Lightweight C++ template library for vector and matrix math, a.k.a. linear algebra."
arch=('any')
url='http://eigen.tuxfamily.org'
license=('GPL3' 'LGPL2.1' 'BSD' 'custom:MPL2' 'custom:MINPACK')
makedepends=('cmake' 'pkg-config' 'freeglut' 'gcc-fortran' 'fftw' 'suitesparse' 'boost')
replaces=('eigen3')
provides=('eigen3')
source=("${pkgname}-${pkgver}.tar.bz2::http://bitbucket.org/eigen/eigen/get/${pkgver}.tar.bz2"
        https://github.com/eigenteam/eigen-git-mirror/commit/35e60f60.patch)
sha1sums=('69fd635550bcf8cffbb05740b5baa4608a3870c7'
          '0fae36b33bf9f9453a4b5620116bf0f981a24692')

prepare() {
  mkdir -p build
  cd eigen-eigen-*
  patch -p1 -i ../35e60f60.patch # Fix build of step
}

build() {
	cd build
	cmake ../eigen-eigen-* \
		-DCMAKE_INSTALL_PREFIX=/usr \
                -DCMAKE_INSTALL_LIBDIR=lib
}

package() {
	cd build
	make DESTDIR="$pkgdir" install

	# install custom licenses
	install -Dm644 ../eigen-eigen-*/COPYING.MPL2 "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
        install -Dm644 ../eigen-eigen-*/COPYING.BSD "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
        install -Dm644 ../eigen-eigen-*/COPYING.MINPACK "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
